package com.zxkj.commonpatrol.adapt;

import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.jakewharton.rxbinding2.view.RxView;

import com.zxkj.commonpatrol.R;
import com.zxkj.commonpatrol.model.entity.SelectProjectEntrity;
import com.zxkj.commonpatrol.model.response.SearchProjectResponse;

import java.util.List;
import java.util.concurrent.TimeUnit;

import io.reactivex.functions.Consumer;

public class SelectProjectAdapt extends BaseQuickAdapter<SearchProjectResponse.RowsBean, BaseViewHolder> {

    public SelectProjectAdapt(int layoutResId, @Nullable List<SearchProjectResponse.RowsBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SearchProjectResponse.RowsBean item) {
        helper.setText(R.id.tv_upcoming_name, item.getName());
        helper.setText(R.id.tv_num, item.getCompletedCount() + "/"+item.getRouteTotal());





        helper.setText(R.id.tv_address, item.getCode());//項目編號
        helper.setText(R.id.tv_pickup_time,item.getProLocation());//位置
        helper.setText(R.id.tv_to_address, item.getCustomerName());//客戶

        TextView viewById = helper.itemView.findViewById(R.id.tv_upcoming_name);
        TextView viewById1 = helper.itemView.findViewById(R.id.tv_num);
        if (item.getCompletedCount()==item.getRouteTotal()){
            viewById.setTextColor(getContext().getColor(R.color.green));
            viewById1.setTextColor(getContext().getColor(R.color.green));
        }else{
            viewById.setTextColor(getContext().getColor(R.color.red));
            viewById1.setTextColor(getContext().getColor(R.color.red));
        }






    }
}